package cn.iocoder.yudao.module.pay.dal.mysql.packagec;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pay.dal.dataobject.packagec.PackageDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pay.controller.admin.packagec.vo.*;

/**
 * 套餐 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PackageMapper extends BaseMapperX<PackageDO> {

    default PageResult<PackageDO> selectPage(PackagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PackageDO>()
                .betweenIfPresent(PackageDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PackageDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PackageDO::getPackageType, reqVO.getPackageType())
                .likeIfPresent(PackageDO::getPackageName, reqVO.getPackageName())
                .eqIfPresent(PackageDO::getOriginalPrice, reqVO.getOriginalPrice())
                .eqIfPresent(PackageDO::getSalePrice, reqVO.getSalePrice())
                .eqIfPresent(PackageDO::getPoints, reqVO.getPoints())
                .eqIfPresent(PackageDO::getWrittenExamQuestionPrice, reqVO.getWrittenExamQuestionPrice())
                .eqIfPresent(PackageDO::getWrittenExamQuestionCount, reqVO.getWrittenExamQuestionCount())
                .eqIfPresent(PackageDO::getWrittenExamDuration, reqVO.getWrittenExamDuration())
                .eqIfPresent(PackageDO::getVoiceReportAnswerEnable, reqVO.getVoiceReportAnswerEnable())
                .eqIfPresent(PackageDO::getCustomerService, reqVO.getCustomerService())
                .eqIfPresent(PackageDO::getRemoteTeachEnable, reqVO.getRemoteTeachEnable())
                .orderByDesc(PackageDO::getId));
    }

}